
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>亚马逊发票模板</title>
    <style>
        table{border-collapse: collapse;width:100%;margin: 0 auto;}
        tr{}
        td{border: 1px solid #000;height:40px; padding-left: 15px;}
        .text-center{text-align: center;}
        .text-bold{font-weight:900;}
        .line-hieght{padding-top: 20px; padding-bottom: 20px;}
    </style>
</head>
<body>
    <!-- 统一保留两位小数 -->
    <table>
        <tr>
            <td class="text-center line-hieght" colspan="4"><h1>Invoice</h1></td>
        </tr>
        <tr>
            <td class="line-hieght" colspan="2">Inv.No. {$order.order_no}</td>
            <td class="line-hieght" colspan="2">Date: {:date('Y-m-d')}</td>
        </tr>
        <tr>
            <td class="line-hieght" colspan="2">
                <p>{$order.consignee}</p>
                <p>{$order.buyer_address_1} {$order.buyer_address_2} {$order.buyer_address_3}</p>
                <p>{$order.buyer_post_code}, {$order.buyer_city}, {$order.buyer_province}</p>
                <p>{$country.name_en}</p>
                <p>{$order.buyer_phone}</p>
            </td>
            <td class="line-hieght" colspan="2"><!-- 每套账号是不一样的发货地址 -->
                <p>{$order.account.tax_num}</p>
                <p>{$sender.address}</p>
                <p>{$sender.city} {$sender.province} {$sender_country.name_en} {$sender.post_code}</p>
            </td>
        </tr>
        <tr class="text-bold">
            <td><h3>Product description</h3></td>
            <td style="width: 120px;"><h3>Quantity</h3></td>
            <td><h3>Unit price</h3></td>
            <td><h3>Total Amount</h3></td>
        </tr>
        {foreach $order.detail as $detail}
        <tr class="text-bold">
            <td><h3>Baby Clothing Set</h3></td>
            <td><h3>{$detail.qty}</h3></td> <!-- 数量 -->
            <td><h3>{$detail.price}</h3></td> <!-- 单价 -->
            <td><h3>{$detail.total_price}</h3></td> <!-- 总价 = 数量*单价 -->
        </tr>
        {/foreach}
        <tr class="text-bold">
            <td><h3>Total Net Amount (Excluding VAT)</h3></td>
            <td></td>
            <td></td>
            {php}$tax_after = round($order['order_price'] / $calculate_rate, 2);{/php}
            <td><h3>{$tax_after}</h3></td> <!-- tax_after = total_price / 1.16(每个国家税不一样) -->
        </tr>
        <tr class="text-bold">
            <td><h3>Tatal VAT (at {$tax_rate}%)</h3></td> <!-- 16% 税 -->
            <td></td>
            <td></td>
            <td><h3>{$order.order_price - $tax_after}</h3></td> <!-- tax_total = total_price - tax_after -->
        </tr>
        <tr class="text-bold">
            <td><h3>Postage</h3></td>
            <td></td>
            <td></td>
            <td><h3>{$order.shipping_price}</h3></td> <!-- 运费 一般情况下为 0 -->
        </tr>
        <tr class="text-bold">
            <td><h3>Total Cost (Including VAT)</h3></td>
            <td></td>
            <td></td>
            <td><h3>{$order.shipping_price + $order.order_price}</h3></td> <!-- 总价加运费 -->
        </tr>
    </table>
</body>
</html>
